<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">

     <el-form-item label="周数" prop="date">
        <span id="currentWeekly">
          第{{this.queryParams.weeks}}周
         </span>
     </el-form-item>

      <el-form-item label="日期" prop="date">
         <span id="currentWeekly">
           <el-date-picker
                v-model="defaultDateStr"
                type="date"
                :format="formatWeek"
                value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="选择日期"
                :default-value="defaultDate"
                @change="handleQuery"
                :clearable="false">
            </el-date-picker>
          </span>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['module:basicsum:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['module:basicsum:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table
    v-loading="loading"
    :data="basicsumList"
    ref="tableMain">
      <el-table-column label="周数" align="center" prop="name" width="100" fixed>
      <template slot-scope="scope">
          <span>第{{ scope.row.weeks }}周</span>
        </template>
      </el-table-column>
      <el-table-column label="时间" align="center" prop="date" width="150" fixed>
      <template slot-scope="scope">
          <span>{{ parseTime(scope.row.date,'{m}月{d}日（星期{a}）') }}</span>
        </template>
      </el-table-column>

      <el-table-column label="鲤城区" align="left" prop="lc"  width="200">
        <template slot-scope="scope">
              <span v-html="scope.row.lc !='' && scope.row.lc ? scope.row.lc.replace(/\n/g, '<br>') : ''"></span>
        </template>
      </el-table-column>
     <el-table-column label="丰泽区" align="left" prop="fz" width="200">
        <template slot-scope="scope">
              <span v-html="scope.row.fz != '' && scope.row.fz ? scope.row.fz.replace(/\n/g, '<br>') : ''"></span>
        </template>
      </el-table-column>
      <el-table-column label="洛江区" align="left" prop="lj"  width="200">
        <template slot-scope="scope">
              <span v-html="scope.row.lj != '' && scope.row.lj ? scope.row.lj.replace(/\n/g, '<br>') : ''"></span>
        </template>
      </el-table-column>
      <el-table-column label="泉港区" align="left" prop="qg" width="200">
        <template slot-scope="scope">
              <span v-html="scope.row.qg != '' && scope.row.qg ? scope.row.qg.replace(/\n/g, '<br>') : ''"></span>
        </template>
      </el-table-column>
      <el-table-column label="石狮市" align="left" prop="ss" width="200">
          <template slot-scope="scope">
              <span v-html="scope.row.ss != '' && scope.row.ss ? scope.row.ss.replace(/\n/g, '<br>') : ''"></span>
          </template>
      </el-table-column>
      <el-table-column label="晋江市" align="left" prop="jj" width="200">
          <template slot-scope="scope">
              <span v-html="scope.row.jj != '' && scope.row.jj ? scope.row.jj.replace(/\n/g, '<br>') : ''"></span>
          </template>
      </el-table-column>
      <el-table-column label="南安市" align="left" prop="na" width="200">
        <template slot-scope="scope">
              <span v-html="scope.row.na != '' && scope.row.na ? scope.row.na.replace(/\n/g, '<br>') : ''"></span>
        </template>
      </el-table-column>
      <el-table-column label="惠安县" align="left" prop="ha" width="200">
        <template slot-scope="scope">
              <span v-html="scope.row.ha != '' && scope.row.ha ? scope.row.ha.replace(/\n/g, '<br>') : ''"></span>
        </template>
      </el-table-column>
      <el-table-column label="安溪县" align="left" prop="ax" width="200">
        <template slot-scope="scope">
              <span v-html="scope.row.ax != '' && scope.row.ax ? scope.row.ax.replace(/\n/g, '<br>') : ''"></span>
        </template>
      </el-table-column>
      <el-table-column label="永春县" align="left" prop="yc" width="200">
        <template slot-scope="scope">
              <span v-html="scope.row.yc != '' && scope.row.yc ? scope.row.yc.replace(/\n/g, '<br>') : ''"></span>
        </template>
      </el-table-column>
      <el-table-column label="德化县" align="left" prop="dh" width="200">
        <template slot-scope="scope">
                <span v-html="scope.row.dh != '' && scope.row.dh ? scope.row.dh.replace(/\n/g, '<br>') : ''"></span>
        </template>
      </el-table-column>
      <el-table-column label="泉州开发区" align="left" prop="kf" width="200">
        <template slot-scope="scope">
                <span v-html="scope.row.kf != '' && scope.row.kf ? scope.row.kf.replace(/\n/g, '<br>') : ''"></span>
        </template>
      </el-table-column>
      <el-table-column label="泉州台商投资区" align="left" prop="ts" width="200">
          <template slot-scope="scope">
                  <span v-html="scope.row.ts != ''&& scope.row.ts ? scope.row.ts.replace(/\n/g, '<br>') : ''"></span>
          </template>
      </el-table-column>

      <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" width="120"  fixed="right">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['module:basicsum:add']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['module:basicsum:delete']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改客户对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" :append-to-body="true">
      <el-form ref="form" :model="form" :rules="rules" label-width="110px">
        <el-form-item label="周数" prop="weeks">
          <span>第{{ form.weeks }}周</span>
        </el-form-item>
        <el-form-item label="日期" prop="date">
          <el-date-picker
               v-model="form.date"
               type="date"
               value-format="yyyy-MM-dd"
               placeholder="选择日期"
                @change="searchEntity">
             </el-date-picker>
        </el-form-item>
        <el-form-item label="鲤城区" prop="lc">
          <DragTextarea :list="form.lcList" type="lc"></DragTextarea>
        </el-form-item>
        <el-form-item label="丰泽区" prop="fz">
          <DragTextarea :list="form.fzList" type="fz"></DragTextarea>
        </el-form-item>
        <el-form-item label="洛江区" prop="lj">
          <DragTextarea :list="form.ljList" type="lj"></DragTextarea>
        </el-form-item>
        <el-form-item label="泉港区" prop="qg">
          <DragTextarea :list="form.qgList" type="qg"></DragTextarea>
        </el-form-item>
        <el-form-item label="石狮市" prop="ss">
          <DragTextarea :list="form.ssList" type="ss"></DragTextarea>
        </el-form-item>
        <el-form-item label="晋江市" prop="jj">
          <DragTextarea :list="form.jjList" type="jj"></DragTextarea>
        </el-form-item>
        <el-form-item label="南安市" prop="na">
          <DragTextarea :list="form.naList" type="na"></DragTextarea>
        </el-form-item>
        <el-form-item label="惠安县" prop="ha">
          <DragTextarea :list="form.haList" type="ha"></DragTextarea>
        </el-form-item>
        <el-form-item label="安溪县" prop="ax">
          <DragTextarea :list="form.axList" type="ax"></DragTextarea>
        </el-form-item>
        <el-form-item label="永春县" prop="yc">
          <DragTextarea :list="form.ycList" type="yc"></DragTextarea>
        </el-form-item>
        <el-form-item label="德化县" prop="dh">
          <DragTextarea :list="form.dhList" type="dh"></DragTextarea>
        </el-form-item>
        <el-form-item label="泉州开发区" prop="kf">
          <DragTextarea :list="form.kfList" type="kf"></DragTextarea>
        </el-form-item>
        <el-form-item label="泉州台商投资区" prop="ts">
          <DragTextarea :list="form.tsList" type="ts"></DragTextarea>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer" style="position: fixed;bottom: 0;right: 25%;width: 20vw;height: 10vh;">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { basicsumApi } from "@/api/module/index";
import { getToken } from "@/utils/auth";
import DragTextarea from "@/components/DragTextarea/dragTextarea"
export default {
  name: "Arrange",
  components:{
    DragTextarea
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],

      items:[],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 客户表格数据
      basicsumList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 20,
        name: null,
        dateStr:null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        date: [
          { required: true, message: "日期不能为空", trigger: "blur" }
        ],
      },

      formatWeek:"yyyy年MM月dd日",

      //默认日期
      defaultDateStr:null,
      defaultDate:null,
    };
  },
  created() {
    //获取下周日期
    this.getNextWeeks();
    this.getList();
  },
  mounted(){
  },
  methods: {
    searchEntity(){
      if(this.form.date){
        this.$modal.loading("匹配数据中...");
        let search = new Object();
        let lc = this.form.lc;
        let fz = this.form.fz;
        let lj = this.form.lj;
        let qg = this.form.qg;
        let ss = this.form.ss;
        let jj = this.form.jj;
        let na = this.form.na;
        let ha = this.form.ha;
        let ax = this.form.ax;
        let yc = this.form.yc;
        let dh = this.form.dh;
        let kf = this.form.kf;
        let ts = this.form.ts;
        let id = this.form.id;

        let lcList = this.form.lcList;
        let fzList = this.form.fzList;
        let ljList = this.form.ljList;
        let qgList = this.form.qgList;
        let ssList = this.form.ssList;
        let jjList = this.form.jjList;
        let naList = this.form.naList;
        let haList = this.form.haList;
        let axList = this.form.axList;
        let ycList = this.form.ycList;
        let dhList = this.form.dhList;
        let kfList = this.form.kfList;
        let tsList = this.form.tsList;

        search.date = this.form.date;
        basicsumApi.listBasicsum(search).then(response => {
          if(response.rows.length > 0){
            this.form = response.rows[0];
            this.handleList(this.form);
          }else{
            this.reset();
            this.form.date = search.date;

            if(!id){
            	this.form.lc = lc;
            	this.form.fz = fz;
            	this.form.lj = lj;
              this.form.qg = qg;
              this.form.ss = ss;
              this.form.jj = jj;
              this.form.na = na;
              this.form.ha = ha;
              this.form.ax = ax;
              this.form.yc = yc;
              this.form.dh = dh;
              this.form.kf = kf;
              this.form.ts = ts;

              this.form.lcList = lcList;
              this.form.fzList = fzList;
              this.form.ljList = ljList;
              this.form.qgList = qgList;
              this.form.ssList = ssList;
              this.form.jjList = jjList;
              this.form.naList = naList;
              this.form.haList = haList;
              this.form.axList = axList;
              this.form.ycList = ycList;
              this.form.dhList = dhList;
              this.form.kfList = kfList;
              this.form.tsList = tsList;

            }

            this.form.weeks = this.getWeeks(this.form.date);
            this.form.children = [];
          }

          this.$modal.closeLoading()
        })
      }

    },
   getNextWeeks(){
   	//获取当周日期
   	let currentDate = new Date();
     let weeksDate = this.parseTime(currentDate,'{a}');
   	let currentDateStr = this.parseTime(currentDate);
     if("日" == weeksDate){
       this.queryParams.weeks = this.getWeeks(currentDateStr) + 1;
       const oneDayMilliseconds = 24 * 60 * 60 * 1000;
       const nextSevenDayTime = currentDate.getTime() + oneDayMilliseconds * 7;
       this.defaultDateStr = this.parseTime(new Date(nextSevenDayTime));
       this.defaultDate = this.defaultDateStr;
     }else{
       this.queryParams.weeks = this.getWeeks(currentDateStr);
       this.defaultDateStr = currentDate;
       this.defaultDate = currentDate;
     }
     this.queryParams.year = this.parseTime(this.defaultDateStr,'{y}');
   },

    getWeeks(val){
    	var year = val.substr(0,4);
    	var month = val.substr(5,2);
    	var day = val.substr(8,2);
    	let weeks = this.getYearWeeks(year,month,day);
    	return weeks;
    },
    /** 查询列表 */
    getList() {
      this.loading = true;
      basicsumApi.listBasicsum(this.queryParams).then(response => {
        let list = response.rows;
        this.basicsumList = response.rows;
        this.total = response.total;


        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        date: null,
        weeks: null,
        lc: null,
        fz: null,
        lj: null,
        qg: null,
        ss: null,
        jj: null,
        na: null,
        ha: null,
        ax: null,
        yc: null,
        dh: null,
        kf: null,
        ts: null,
        lcList:[],
        fzList:[],
        ljList:[],
        qgList:[],
        ssList:[],
        jjList:[],
        naList:[],
        haList:[],
        axList:[],
        ycList:[],
        dhList:[],
        kfList:[],
        tsList:[],
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.weeks = this.getWeeks(this.defaultDateStr);
      //this.queryParams.date = this.defaultDateStr;
      this.queryParams.year = this.defaultDateStr.substr(0,4);

      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    handleCurrentChange(val) {
      this.currentRow = val;
    },
    /** 新增按钮操作 */
    handleAdd(row) {
      this.reset();
      this.form.children = [];
      this.handleList(this.form);
      this.open = true;
      this.title = "添加调研情况汇总";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      this.title = "修改调研情况汇总";
      this.open = true;
      this.handleList(row);
      this.form = {...row};
    },
    /** 提交按钮 */
    submitForm() {
      this.copyData();
      this.$refs["form"].validate(valid => {
        if (valid) {
          //获取周数
          var year = this.form.date.substr(0,4);
          var month = this.form.date.substr(5,2);
          var day = this.form.date.substr(8,2);
          this.form.weeks = this.getYearWeeks(year,month,day);
          basicsumApi.saveAllBasicsum(this.form).then(response => {
            this.$modal.msgSuccess("操作成功");
            this.open = false;
            this.getList();
          });

        }
      });
    },

    //整理数据
    copyData(){
      let userId = this.$store.getters.userId;
      let nickName = this.$store.getters.nickName;
      let flag = this.form.children.some(user => user.userId.toString() === userId);
      let ownData;
      if(flag){
          ownData = this.form.children.find(item => item.userId.toString() === userId);//fiter()过滤出对应数据，返回Array
      }else{
          ownData = new Object();
          ownData.userId = userId;
          ownData.basicsumId = this.form.id;
          ownData.nickName = nickName;
      }
      this.sumData(ownData);
      this.form.basicsumCtrl = ownData;
      this.sumFormData();
    },

    //整理当前用户数据
    sumData(item){
      let userId = this.$store.getters.userId;
      let lcData = this.form.lcList.find(item => item.userId.toString() === userId);//find()查找第一个数据
      let fzData = this.form.fzList.find(item => item.userId.toString() === userId);
      let qgData = this.form.qgList.find(item => item.userId.toString() === userId);
      let ljData = this.form.ljList.find(item => item.userId.toString() === userId);
      let ssData = this.form.ssList.find(item => item.userId.toString() === userId);
      let jjData = this.form.jjList.find(item => item.userId.toString() === userId);
      let naData = this.form.naList.find(item => item.userId.toString() === userId);
      let haData = this.form.haList.find(item => item.userId.toString() === userId);
      let axData = this.form.axList.find(item => item.userId.toString() === userId);
      let ycData = this.form.ycList.find(item => item.userId.toString() === userId);
      let dhData = this.form.dhList.find(item => item.userId.toString() === userId);
      let kfData = this.form.kfList.find(item => item.userId.toString() === userId);
      let tsData = this.form.tsList.find(item => item.userId.toString() === userId);
      item.lc = lcData.lc;
      item.fz = fzData.fz;
      item.qg = qgData.qg;
      item.lj = ljData.lj;
      item.ss = ssData.ss;
      item.jj = jjData.jj;
      item.na = naData.na;
      item.ha = haData.ha;
      item.ax = axData.ax;
      item.yc = ycData.yc;
      item.dh = dhData.dh;
      item.kf = kfData.kf;
      item.ts = tsData.ts;
    },

    sumFormData(){
      this.form.lc = this.form.lcList.reduce((accumulator, item) => {
        return item.lc ? accumulator + item.lc + "\n" : accumulator + "";
      }, '');
      this.form.fz = this.form.fzList.reduce((accumulator, item) => {
        return item.fz ? accumulator + item.fz + "\n" : accumulator + ""
      }, '');
      this.form.qg = this.form.qgList.reduce((accumulator, item) => {
        return item.qg ? accumulator + item.qg + "\n" : accumulator + ""
      }, '');
      this.form.lj = this.form.ljList.reduce((accumulator, item) => {
        return item.lj ? accumulator + item.lj + "\n" : accumulator + ""
      }, '');
      this.form.ss = this.form.ssList.reduce((accumulator, item) => {
        return item.ss ? accumulator + item.ss + "\n" : accumulator + ""
      }, '');
      this.form.jj = this.form.jjList.reduce((accumulator, item) => {
        return item.jj ? accumulator + item.jj + "\n" : accumulator + ""
      }, '');
      this.form.na = this.form.naList.reduce((accumulator, item) => {
        return item.na ? accumulator + item.na + "\n" : accumulator + ""
      }, '');
      this.form.ha = this.form.haList.reduce((accumulator, item) => {
        return item.ha ? accumulator + item.ha + "\n" : accumulator + ""
      }, '');
      this.form.ax = this.form.axList.reduce((accumulator, item) => {
        return item.ax ? accumulator + item.ax + "\n" : accumulator + ""
      }, '');
      this.form.yc = this.form.ycList.reduce((accumulator, item) => {
        return item.yc ? accumulator + item.yc + "\n" : accumulator + ""
      }, '');
      this.form.dh = this.form.dhList.reduce((accumulator, item) => {
        return item.dh ? accumulator + item.dh + "\n" : accumulator + ""
      }, '');
      this.form.kf = this.form.kfList.reduce((accumulator, item) => {
        return item.kf ? accumulator + item.kf + "\n" : accumulator + ""
      }, '');
      this.form.ts = this.form.tsList.reduce((accumulator, item) => {
        return item.ts ? accumulator + item.ts + "\n" : accumulator + ""
      }, '');
    },

    /* handleForm(){
      if(this.form.lcList){
        this.form.lc = "";
        for(let item of this.form.lcList){
           this.form.lc = this.form.lc + item.lc + "\n";
        }
      }

    }, */
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除该数据项？').then(function() {
        return basicsumApi.delBasicsum(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('basicsum/export', {
        ...this.queryParams
      }, `第`+ this.queryParams.weeks +`周市领导下基层调研情况汇总表.xlsx`)//
    },

    handleList(row){
       let userId = this.$store.getters.userId;
       let lc = row.lc;
       let fz = row.fz;
       let lj = row.lj;
       let qg = row.qg;
       let ss = row.ss;
       let jj = row.jj;
       let na = row.na;
       let ha = row.ha;
       let ax = row.ax;
       let yc = row.yc;
       let dh = row.dh;
       let kf = row.kf;
       let ts = row.ts;
       let lcList = [];
       let fzList = [];
       let ljList = [];
       let qgList = [];
       let ssList = [];
       let jjList = [];
       let naList = [];
       let haList = [];
       let axList = [];
       let ycList = [];
       let dhList = [];
       let kfList = [];
       let tsList = [];
       for(let basicsumCtrl of row.children){
         if(basicsumCtrl.lc && lc){
           basicsumCtrl.sort = lc.indexOf(basicsumCtrl.lc);
           let basicItem = JSON.parse(JSON.stringify(basicsumCtrl));
           lcList.push(basicItem);
         }
         if(basicsumCtrl.fz && fz){
           basicsumCtrl.sort = fz.indexOf(basicsumCtrl.fz);
           let basicItem = JSON.parse(JSON.stringify(basicsumCtrl));
           fzList.push(basicItem);
         }
         if(basicsumCtrl.lj && lj){
           basicsumCtrl.sort = lj.indexOf(basicsumCtrl.lj);
           let basicItem = JSON.parse(JSON.stringify(basicsumCtrl));
           ljList.push(basicItem);
         }
         if(basicsumCtrl.qg && qg){
           basicsumCtrl.sort = qg.indexOf(basicsumCtrl.qg);
           let basicItem = JSON.parse(JSON.stringify(basicsumCtrl));
           qgList.push(basicItem);
         }
         if(basicsumCtrl.ss && ss){
           basicsumCtrl.sort = ss.indexOf(basicsumCtrl.ss);
           let basicItem = JSON.parse(JSON.stringify(basicsumCtrl));
           ssList.push(basicItem);
         }
         if(basicsumCtrl.jj && jj){
           basicsumCtrl.sort = jj.indexOf(basicsumCtrl.jj);
           let basicItem = JSON.parse(JSON.stringify(basicsumCtrl));
           jjList.push(basicItem);
         }
         if(basicsumCtrl.na && na){
           basicsumCtrl.sort = na.indexOf(basicsumCtrl.na);
           let basicItem = JSON.parse(JSON.stringify(basicsumCtrl));
           naList.push(basicItem);
         }
         if(basicsumCtrl.ha && ha){
           basicsumCtrl.sort = ha.indexOf(basicsumCtrl.ha);
           let basicItem = JSON.parse(JSON.stringify(basicsumCtrl));
           haList.push(basicsumCtrl);
         }
         if(basicsumCtrl.ax && ax){
           basicsumCtrl.sort = ax.indexOf(basicsumCtrl.ax);
           let basicItem = JSON.parse(JSON.stringify(basicsumCtrl));
           axList.push(basicItem);
         }
         if(basicsumCtrl.yc && yc){
           basicsumCtrl.sort = yc.indexOf(basicsumCtrl.yc);
           let basicItem = JSON.parse(JSON.stringify(basicsumCtrl));
           ycList.push(basicItem);
         }
         if(basicsumCtrl.dh && dh){
           basicsumCtrl.sort = dh.indexOf(basicsumCtrl.dh);
           let basicItem = JSON.parse(JSON.stringify(basicsumCtrl));
           dhList.push(basicItem);
         }
         if(basicsumCtrl.kf && kf){
           basicsumCtrl.sort = kf.indexOf(basicsumCtrl.kf);
           let basicItem = JSON.parse(JSON.stringify(basicsumCtrl));
           kfList.push(basicItem);
         }
         if(basicsumCtrl.ts && ts){
           basicsumCtrl.sort = ts.indexOf(basicsumCtrl.ts);
           let basicItem = JSON.parse(JSON.stringify(basicsumCtrl));
           tsList.push(basicItem);
         }
       }
       lcList.sort((a, b) => a.sort - b.sort);
       fzList.sort((a, b) => a.sort - b.sort);
       ljList.sort((a, b) => a.sort - b.sort);
       qgList.sort((a, b) => a.sort - b.sort);
       ssList.sort((a, b) => a.sort - b.sort);
       jjList.sort((a, b) => a.sort - b.sort);
       naList.sort((a, b) => a.sort - b.sort);
       haList.sort((a, b) => a.sort - b.sort);
       axList.sort((a, b) => a.sort - b.sort);
       ycList.sort((a, b) => a.sort - b.sort);
       dhList.sort((a, b) => a.sort - b.sort);
       kfList.sort((a, b) => a.sort - b.sort);
       tsList.sort((a, b) => a.sort - b.sort);
       let lcFlag = lcList.some(user => user.userId.toString() === userId);
       if(!lcFlag){
         let lcVal = {};
         lcVal.userId = userId;
         lcVal.lc = "";
         lcList.push(lcVal);
       }

       let fzFlag = fzList.some(user => user.userId.toString() === userId);
       if(!fzFlag){
         let fzVal = {};
         fzVal.userId = userId;
         fzVal.fz = "";
         fzList.push(fzVal);
       }

       let ljFlag = ljList.some(user => user.userId.toString() === userId);
       if(!ljFlag){
         let ljVal = {};
         ljVal.userId = userId;
         ljVal.lj = "";
         ljList.push(ljVal);
       }

       let qgFlag = qgList.some(user => user.userId.toString() === userId);
       if(!qgFlag){
         let qgVal = {};
         qgVal.userId = userId;
         qgVal.qg = "";
         qgList.push(qgVal);
       }

       let ssFlag = ssList.some(user => user.userId.toString() === userId);
       if(!ssFlag){
         let ssVal = {};
         ssVal.userId = userId;
         ssVal.ss = "";
         ssList.push(ssVal);
       }

       let jjFlag = jjList.some(user => user.userId.toString() === userId);
       if(!jjFlag){
         let jjVal = {};
         jjVal.userId = userId;
         jjVal.jj = "";
         jjList.push(jjVal);
       }

       let naFlag = naList.some(user => user.userId.toString() === userId);
       if(!naFlag){
         let naVal = {};
         naVal.userId = userId;
         naVal.na = "";
         naList.push(naVal);
       }

       let haFlag = haList.some(user => user.userId.toString() === userId);
       if(!haFlag){
         let haVal = {};
         haVal.userId = userId;
         haVal.ha = "";
         haList.push(haVal);
       }

       let axFlag = axList.some(user => user.userId.toString() === userId);
       if(!axFlag){
         let axVal = {};
         axVal.userId = userId;
         axVal.ax = "";
         axList.push(axVal);
       }

       let ycFlag = ycList.some(user => user.userId.toString() === userId);
       if(!ycFlag){
         let ycVal = {};
         ycVal.userId = userId;
         ycVal.yc = "";
         ycList.push(ycVal);
       }

       let dhFlag = dhList.some(user => user.userId.toString() === userId);
       if(!dhFlag){
         let dhVal = {};
         dhVal.userId = userId;
         dhVal.dh = "";
         dhList.push(dhVal);
       }

       let kfFlag = kfList.some(user => user.userId.toString() === userId);
       if(!kfFlag){
         let kfVal = {};
         kfVal.userId = userId;
         kfVal.kf = "";
         kfList.push(kfVal);
       }

       let tsFlag = tsList.some(user => user.userId.toString() === userId);
       if(!tsFlag){
         let tsVal = {};
         tsVal.userId = userId;
         tsVal.ts = "";
         tsList.push(tsVal);
       }
       row.lcList = lcList;
       row.fzList = fzList;
       row.ljList = ljList;
       row.qgList = qgList;
       row.ssList = ssList;
       row.jjList = jjList;
       row.naList = naList;
       row.haList = haList;
       row.ycList = ycList;
       row.axList = axList;
       row.dhList = dhList;
       row.kfList = kfList;
       row.tsList = tsList;
    },


  }
};
</script>
<style scoped>
  /deep/ .el-table__header-wrapper  .el-checkbox{
     display:none
   }
   .editable-content > div.not-editable {
     user-select: none;
     display: inline-block;
   }
</style>
